'use strict';

const Controller = require('egg').Controller;

const jwt = require('jsonwebtoken');

class MenuController extends Controller {
  async power() {
      const {ctx} = this;
    // console.log(ctx);
    let token = ctx.request.header.token;
    let info = jwt.verify(token,'1705d');
    console.log("info====",info);
    try{
        let data = await this.service.menu.power(info.roleid);
        console.log(data);
        ctx.body = {
            code:1,
            data
        }
    }catch(e){
        ctx.body = {
            code:0,
            msg:e
        }
    }
  }
}

module.exports = MenuController;

//请求体  请求头  cookie
